package com.sugar.subscribe.course.module.business.dal.mysql.city;

import java.util.*;

import com.sugar.subscribe.course.framework.common.pojo.PageResult;
import com.sugar.subscribe.course.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.subscribe.course.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.subscribe.course.module.business.dal.dataobject.city.CityDO;
import org.apache.ibatis.annotations.Mapper;
import com.sugar.subscribe.course.module.business.controller.admin.city.vo.*;

/**
 * 城市 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface CityMapper extends BaseMapperX<CityDO> {

    default PageResult<CityDO> selectPage(CityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CityDO>()
                .likeIfPresent(CityDO::getName, reqVO.getName())
                .betweenIfPresent(CityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CityDO::getSort));
    }

}